---
---
<!DOCTYPE html> 
<html lang=en>
<head>
	<meta charset=utf-8>

	<link rel="stylesheet" type="text/css" href="{{ site.baseurl }}/common/css/stylesheet.css"/>
	<link rel="stylesheet" href="{{ site.baseurl }}/common/css/stylesheet-fonts.css" type="text/css" charset="utf-8">
	<link rel="icon" href="{{ site.baseurl }}/common/css/favicon.ico" type="image/x-icon">
	<link rel="shortcut icon" href="{{ site.baseurl }}/common/css/favicon.ico" type="image/x-icon">
	<title>Using Redis With Magento Community Edition (CE) or Enterprise Edition (EE)</title>

</head>

<body>
<a name="top"></a>
<img src="{{ site.baseurl }}/common/images/m1x/m1xheader.png" width="1024" alt="header" />




<div id="content">

<h1>Using Redis With Magento Community Edition (CE) or Enterprise Edition (EE)</h1>

<h4 id="top">Contents</h4>
<ul><li><a href="#overview">概述</a></li>
<li><a href="#matrix">Requirements for Using Redis with Magento</a></li>
<li><a href="#config">Configuring Redis</a></li>
<li><a href="#support">Getting Support for Redis</a></li>
<!-- <li><a href="#install">Installing and Configuring Redis</a></li> -->
<li><a href="#more-info">For More Information</a></li>
<li><a href="#ack">Acknowledgment</a></li></ul> 

<h2 id="overview">概述</h2>
<p><a href="http://redis.io/" target="_blank">Redis</a> is an open source, Berkeley Software Distribution (BSD) licensed, advanced key-value store that can optionally be used in Magento for back end and session storage. In fact, you can replace memcached with Redis.</p>
<p>Following are some of the benefits Redis provides for Magento implementations:</p>
<ul><li>Redis supports on-disk save and master/slave replication. This is a powerful feature not supported by memcached. Replication enables high availability by eliminating a single point of failure.</li>
<li>Redis can be used for PHP session storage.</li>
<li>Redis provides much better eviction control and its back end is written with eviction support in mind.</li>
<li>Redis supports multiple databases that use the same server instance so you can use different databases for the Magento cache, full page cache <em>(EE only)</em>, and sessions without starting many processes listening on different ports.</li>
<li>Redis supports compression libraries <a href="http://www.gzip.org/" target="_blank"><tt>gzip</tt></a>, <a href="http://search.cpan.org/dist/Compress-LZF/LZF.pm" target="_blank"><tt>lzf</tt></a>,以及<a href="https://code.google.com/p/snappy/" target="_blank"><tt>snappy</tt></a>. lzf and snappy are much faster than gzip.</li>
<li>Limits the number of concurrent lock requests before an <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.4" target="_blank">HTTP 503 (Service Unavailable)</a> error is returned.</li>
</ul>

<h2 id="matrix">Requirements for Using Redis with Magento</h2>
<p>The following Magento editions support Redis session and back end caching:</p>
<ul><li>Enterprise Edition (EE) 1.13 and later</li>
<li>Community Edition (CE) 1.8</li></ul>
<p>The preceding Magento editions support Redis server version 2.6.9 and later available from <a href="http://redis.io" target="_blank">redis.io</a>.</p>
<p>In addition, you can optionally use the <a href="http://pecl.php.net/package/redis" target="_blank">Redis extension for PHP</a> version 2.2.3或更新 if you're using Redis for back end caching; however, Magento works without this extension.</p>

<h2 id="config">Configuring Redis</h2>
<p>To use Redis with Magento, you must configure Magento to use Redis and you must install and configure the Redis server. These tasks are discussed in the following sections:</p>
<ul><li><a href="#config-mage">Configuring Magento To Use Redis</a></li>
<li><a href="#config-redis">Installing and Configuring the Redis Server</a></li></ul>

<h3 id="config-mage">Configuring Magento To Use Redis</h3>
<p>To use Redis with Magento, you only need to install and configure the Redis server. The integration between Redis and Magento is already included with Magento CE 1.8 and EE 1.13 and later versions. All you need to do is configure it.</p>
<p class="kb-notes"><strong>重要:</strong> The Cm_RedisSession module in CE 1.8 is disabled by default. Magento disables the module to avoid unnecessary connection tries to Redis when you choose to use file, database, or a different session storage method.</p>
<p>To enable Magento to use Redis, perform the following tasks:</p>
<ol><li>Enable the Cm_RedisSession module.
<ol><li>Open <em>magento-install-dir</em><tt>/app/etc/modules/Cm_RedisSession.xml</tt> in a text editor.</li>
<li>Change the value of <tt>&lt;active></tt> to <tt>true</tt>.</li>
<li>Save your changes to <tt>Cm_RedisSession.xml</tt> and exit the text editor.</li></ol>
</li>
<li>Modify <em>magento-install-dir</em><tt>/app/etc/local.xml</tt>.<br />
For configuration information, see the sample provided with Magento in <em>magento-install-dir</em><tt>/app/etc/local.xml.additional</tt> and also see the <a href="https://github.com/colinmollenhour/Cm_RedisSession/blob/master/README.md" target="_blank">Readme (session)</a>和<a href="https://github.com/colinmollenhour/Cm_Cache_Backend_Redis/blob/master/README.md" target="_blank">Readme (back end)</a>.</li>
<li>Flush the Magento cache in any of the following ways:
<ul><li>If you have access to the file system as the owner of the files in the Magento installation directory, change to that directory and enter <tt>rm -rf var/cache</tt>.</li>
<li>Log in to the Admin Panel as an administrator. Click <strong>System</strong> > <strong>Cache Management</strong>, then click <strong>Flush Magento Cache</strong> at the top of the page.</li></ul>
</li>
</ol>

<h3 id="config-redis">Installing and Configuring the Redis Server</h3>
<p>Get <a href="http://redis.io/download" target="_blank">Redis server</a> version 2.6.9或更新 and configure it according to <a href="http://redis.io/documentation" target="_blank">their documentation</a>.</p>
<p>You can optionally install the <a href="http://pecl.php.net/package/redis" target="_blank">Redis extension for PHP</a> version 2.2.3或更新 as well, but Magento functions without it.</p>

<h2 id="support">Getting Support for Redis</h2>
<p class="kb-notes"><strong>重要:</strong> Colin Mollenhour, the original author of Redis, does <em>not</em> provide support for Magento implementations. You can get support for Magento implementations in the following ways:</p>
<table>
<tbody>
<tr>
<th>Magento edition</th>
<th>How to get help</th>
<tr> 
  <td>Magento CE and Magento EE</td>
  <td><ul><li><a href="http://www.magentocommerce.com/boards/" target="_blank">Magento support forums</a></li>
  <!-- <li><a href="http://magento.stackexchange.com" target="_blank">magento.stackexchange.com</a></li> -->
  <li><a href="https://twitter.com/ask_magento" target="_blank">Twitter (<tt>@ask_magento</tt>)</a></li></ul>
  </td>
</tr>
<tr> 
  <td>Magento CE</td>
  <td><a href="http://www.magentocommerce.com/bug-tracking" target="_blank">Submit bug reports</td>
</tr>
<tr> 
  <td>Magento EE only</td>
  <td><a href="http://support.magentocommerce.com" target="_blank">Submit bug reports</a></td>
</tr>
</tbody>
</table>

<h2 id="more-info">For More Information</h2>
<p>For more information about using Redis with Magento, see:</p>
<ul><li><a href="http://info2.magento.com/rs/magentosoftware/images/MagentoECG-UsingRedisasaCacheBackendinMagento.pdf" target="_blank">Magento Expert Consulting Group (ECG) article</a>.</li>
<li><a href="http://redis.io/documentation" target="_blank">Redis server documentation</a>.</li></ul>

<h2 id="ack">Acknowledgment</h2>
<p>Magento acknowledges the contributions of Colin Mollenhour in providing the code for the Magento implementation of Redis.</p>



<!-- <h2 id="install">Installing and Configuring Redis</h2> -->

</body>
</html>